import { onMounted, onBeforeUnmount } from "vue";
import {VCairnController} from '../vcc/VCairnController';

export class VueCairnController<P=any, E=any> extends VCairnController {
    protected props?:P;
    protected emitter?:E;

    constructor(props?: P, emitter?: E) {
        super();
        this.props = props;
        this.emitter = emitter;
        onMounted(this.init.bind(this));
        onBeforeUnmount(this.destroy.bind(this));
    }

    // 子类重写
    protected init() {

    }

    // 子类重写
    protected destroy() {}
}